package com.vis.uitls
{
	import mx.formatters.DateFormatter;
	
	public class DateUtil 
	{
		public static const DATE_TYPE:String = "MM/DD/YYYY";
		public static function lte(date1:Date, date2:Date):Boolean {
			if(date1.valueOf() <= date2.valueOf()){
				return true;
			} else {
				return false;				
			}
		}
		public static function convertToDate(dateString:String):Date { 
			var date:Date = DateFormatter.parseDateString((dateString.replace(/[^0-9,]/ig, "")).replace(/,/ig,"/"));
			return date;
		}
		
		public static function convertToString(date:Object):String {
			var df:DateFormatter = new DateFormatter();
			df.formatString = DateUtil.DATE_TYPE;
			return df.format(date);
		}
	}
}